package com.wbk.lotterysystemsystemservice.controller.auth;


import com.wbk.lotterysystemsystemservice.controller.auth.biz.UploadBiz;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import result.Result;


import java.io.File;
import java.io.IOException;

//@CrossOrigin
@Api
@RestController
@RequestMapping("/system/api/auth/upload")
public class UploadController {

    @Autowired
    UploadBiz uploadBiz;

    @ApiOperation(value = "上传图片接口", notes = "上传图片")
    @PostMapping("/imag")
    public Result<String> uploadImag(@RequestParam(value = "userNo") Long userNo,
                                     @RequestParam(value = "file") MultipartFile file) throws IOException {
        return uploadBiz.uploadImag(userNo, file);
    }

    @ApiOperation(value = "上传二维码接口", notes = "上传二维码")
    @PostMapping("/qrCode")
    public String uploadQrCode(@RequestParam(value = "storeUserNo") Long storeUserNo,
                                       @RequestParam(value = "file") File file) throws IOException {
        return uploadBiz.uploadQrCode(storeUserNo,file);
    }

}
